#ifndef FILE_MANGER
#define FILE_MANGER

#include <pthread.h>

#ifndef TABLE_SIZE
#define TABLE_SIZE  20
#endif

typedef struct {
    char file_name[32];
    pthread_rwlock_t rwlock;
}file_lock_t;

typedef struct HashNode {
    file_lock_t* data;
    struct HashNode* next;
} HashNode;

typedef struct {
    HashNode* table[TABLE_SIZE];
    int file_cnt;
    //这里应该加一个锁，当哈希表进行插入删除时候应该加锁
} HashTable;

HashTable* createHashTable();
void insertHashTable(HashTable* hashTable, file_lock_t* data);
file_lock_t* findInHashTable(HashTable* hashTable, const char* targetStr);
void delete_hash_node(HashTable* hash_table, const char* file_name);


#endif